package com.meituan.meituanservice.service.impl;

import com.meituan.meituanservice.mapper.AddressMapper;
import com.meituan.meituanservice.model.Address;
import com.meituan.meituanservice.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class AddressServiceImpl implements AddressService {
    @Autowired
    AddressMapper addressMapper;
    @Override
    public List<Address> GetAddressByUserId(String userId) {
        return addressMapper.selectAllByUserId(userId);
    }

    @Override
    public int deleteAddress(String addressId) {
        return addressMapper.deleteById(addressId);
    }

    @Override
    public int add(Address address) {
        return addressMapper.insert(address);
    }

    @Override
    public int update(Address address) {
        return addressMapper.update(address);
    }
}
